import { _decorator, Component, Node } from 'cc';
import { GameManager } from './GameManager';
const { ccclass, property } = _decorator;

@ccclass('Pipe')
export class Pipe extends Component {
    private moveSpeed: number = 100;
    start() {
        this.moveSpeed = GameManager.inst().moveSpeed;
    }

    update(deltaTime: number) {
        const {x,y} = this.node.position
        this.node.setPosition(x-this.moveSpeed*deltaTime, y)

        if(x < -900){
            this.node.destroy()
        }
    }
}

